package com.moleq.models;

import com.moleq.db.DatabaseSchema;

//CREATE TABLE t_pos_setting
//(ps_id INTEGER NOT NULL,
//ps_station numeric(3,0) Default 0 NOT NULL,
//ps_open_time varchar(6) NULL,
//ps_close_time varchar(6) NULL,
//ps_tare_rate numeric(8,3) Default 0 NOT NULL,
//ps_fc_max integer NULL,
//create_datetime varchar(14) NOT NULL,
//update_datetime varchar(14) NOT NULL,
//ps_weight_unit varchar(2) NULL,
//ps_store_no integer Default 0 NOT NULL,
//ps_price_digits numeric(3,0) NULL,
//ps_currency_sign varchar(5) NULL,
//ps_out_of_paper varchar(1) NULL,
//ps_calc_weight varchar(1) DEFAULT '0' NOT NULL,
//ps_calendar_type varchar(1) DEFAULT '1' NULL,
//ps_norm_upce varchar(1) DEFAULT '1' NOT NULL,
//ps_network_onoff varchar(1) DEFAULT '0' NOT NULL,
//ps_show_desc varchar(1) DEFAULT '0' NOT NULL,
//ps_dvr varchar(1) DEFAULT '0' NOT NULL,
//ps_zero_baln varchar(1) DEFAULT '1' NOT NULL,
//ps_zero_price varchar(1) DEFAULT '0' NOT NULL,
//ps_fs_tax_rule numeric(3,0) DEFAULT 1 NOT NULL,
//ps_prctag_printer integer NULL,
//ps_rounding integer NULL,
//ps_print_service varchar(1) DEFAULT '0' NOT NULL,
//ps_sig_host varchar(1) DEFAULT '0' NOT NULL,
//ps_sig_local varchar(1) DEFAULT '0' NOT NULL,
//ps_sig_min numeric(8,3) NULL;
//ps_receipt_pnt integer NULL,
//PRIMARY KEY (ps_id))

public class PosSetting {

	private static int ps_id;
	private int ps_station;
	private String ps_open_time;
	private String ps_close_time;
	private double ps_tare_rate;
	private int ps_fc_max;
	private String create_datetime;
	private String update_datetime;
	private String ps_weight_unit;
	private int price_digits;
	private int store_no;
	private String currency_sign;
	private String outofpaper;
	private String calculate_weight;
	private String calendar_type;
	private String norm_upce;
	private String network_onoff;
	private String show_desc;
	private String dvr;
	private String zero_baln;
	private String zero_price;
	private int ps_fs_tax_rule;
	private int ps_prctag_printer;
	private int ps_rounding;
	private String ps_print_service;
	private String ps_sig_host;
	private String ps_sig_local;
	private double ps_sig_min;
	private int ps_receipt_pnt;
	
	public PosSetting() {
	}

	public PosSetting(int ps_id, int ps_station,String ps_open_time,String ps_close_time,
			int ps_fc_max, String create_datetime,String update_datetime,String ps_weight_unit,
			int price_digits,double ps_tare_rate,int store_no,String currency_sign,String outofpaper,
			String calculate_weight,String calendar_type,String norm_upce,String network_onoff,
			String show_desc,String dvr,String zero_baln,String zero_price,int ps_fs_tax_rule,
			int ps_prctag_printer,int ps_rounding,String ps_print_service,String ps_sig_host,
			String ps_sig_local,double ps_sig_min,int ps_receipt_pnt) {
		this.ps_id = ps_id;
		this.ps_station = ps_station;
		this.ps_open_time = ps_open_time;
		this.ps_close_time = ps_close_time;
		this.ps_fc_max = ps_fc_max;
		this.create_datetime=create_datetime;
		this.update_datetime=update_datetime;
		this.ps_weight_unit = ps_weight_unit;
		this.price_digits = price_digits;
		this.ps_tare_rate = ps_tare_rate;
		this.store_no = store_no;
		this.currency_sign = currency_sign;
		this.outofpaper = outofpaper;
		this.calculate_weight = calculate_weight;
		this.calendar_type = calendar_type;
		this.norm_upce = norm_upce;
		this.network_onoff = network_onoff;
		this.show_desc = show_desc;
		this.dvr = dvr;
		this.zero_baln = zero_baln;
		this.zero_price = zero_price;
		this.ps_fs_tax_rule = ps_fs_tax_rule;
		this.ps_prctag_printer = ps_prctag_printer;
		this.ps_rounding = ps_rounding;
		this.ps_print_service = ps_print_service;
		this.ps_sig_host = ps_sig_host;
		this.ps_sig_local = ps_sig_local;
		this.ps_sig_min = ps_sig_min;
		this.ps_receipt_pnt = ps_receipt_pnt;
	}
	
	public String getZero_baln() {
		return zero_baln;
	}

	public void setZero_baln(String zero_baln) {
		this.zero_baln = zero_baln;
	}

	public String getZero_price() {
		return zero_price;
	}

	public void setZero_price(String zero_price) {
		this.zero_price = zero_price;
	}

	public int getPs_id() {
		return ps_id;
	}
	public void setPs_id(int ps_id) {
		this.ps_id = ps_id;
	}
	public int getPs_station() {
		return ps_station;
	}
	public void setPs_station(int ps_station) {
		this.ps_station = ps_station;
	}
	public String getPs_open_time() {
		return ps_open_time;
	}
	public void setPs_open_time(String ps_open_time) {
		this.ps_open_time = ps_open_time;
	}
	public String getPs_close_time() {
		return ps_close_time;
	}
	public void setPs_close_time(String ps_close_time) {
		this.ps_close_time = ps_close_time;
	}
	public double getPs_tare_rate() {
		return ps_tare_rate;
	}
	public void setPs_tare_rate(double ps_tare_rate) {
		this.ps_tare_rate = ps_tare_rate;
	}
	public int getPs_fc_max() {
		return ps_fc_max;
	}
	public void setPs_fc_max(int ps_fc_max) {
		this.ps_fc_max = ps_fc_max;
	}
	public String getCreate_datetime() {
		return create_datetime;
	}
	public void setCreate_datetime(String create_datetime) {
		this.create_datetime = create_datetime;
	}
	public String getUpdate_datetime() {
		return update_datetime;
	}
	public void setUpdate_datetime(String update_datetime) {
		this.update_datetime = update_datetime;
	}
	public String getPs_weight_unit() {
		return ps_weight_unit;
	}

	public void setPs_weight_unit(String ps_weight_unit) {
		this.ps_weight_unit = ps_weight_unit;
	}
	
	public int getPrice_digits() {
		return price_digits;
	}

	public void setPrice_digits(int price_digits) {
		this.price_digits = price_digits;
	}

	public int getStore_no() {
		return store_no;
	}

	public void setStore_no(int store_no) {
		this.store_no = store_no;
	}

	public String getCurrency_sign() {
		return currency_sign;
	}

	public void setCurrency_sign(String currency_sign) {
		this.currency_sign = currency_sign;
	}

	public String getOutofpaper() {
		return outofpaper;
	}

	public void setOutofpaper(String outofpaper) {
		this.outofpaper = outofpaper;
	}
	
	public String getCalculate_weight() {
		return calculate_weight;
	}
	
	public boolean isCalcWeight(){
		return getCalculate_weight().equals("1")?true:false;
	}
	
	public boolean isOutOfPaper(){
		return this.getOutofpaper().equals("1")?true:false;
	}
	
	public boolean isCalendarType(){
		return this.getCalendar_type().equals("1")?true:false;
	}
	
	public boolean isNormUpce(){
		return this.getNorm_upce().equals("1")?true:false;
	}
	
	public boolean isMGNetwork(){
		return this.getNetwork_onoff().equals("1")?true:false;
	}
	
	public boolean isShowDesc(){
		return this.getShow_desc().equals("1")?true:false;
	}
	
	public boolean isDVR(){
		return this.getDvr().equals("1")?true:false;
	}
	
	public boolean isZeroBaln(){
		return this.getZero_baln().equals("1")?true:false;
	}
	
	public boolean isZeroPrice(){
		return this.getZero_price().equals("1")?true:false;
	}
	
	public boolean isPrintServic(){
		return this.getPs_print_service().equals("1")?true:false;
	}
	
	public boolean isSigHost(){
		return this.getPs_sig_host().equals("1")?true:false;
	}
	
	public boolean isSaveSig(){
		return this.getPs_sig_local().equals("1")?true:false;
	}
	
	public boolean getIs_prctag_printer(){
		if (this.getPs_prctag_printer() > 0) {
			return true;
		}
		return false;
	}
	
	public boolean getIs_rounding(){
		if (this.getPs_rounding() > 0) {
			return true;
		}
		return false;
	}

	public void setCalculate_weight(String calculate_weight) {
		this.calculate_weight = calculate_weight;
	}

	public String getCalendar_type() {
		return calendar_type;
	}

	public void setCalendar_type(String calendar_type) {
		this.calendar_type = calendar_type;
	}

	public String getNorm_upce() {
		return norm_upce;
	}

	public void setNorm_upce(String norm_upce) {
		this.norm_upce = norm_upce;
	}

	public String getNetwork_onoff() {
		return network_onoff;
	}

	public void setNetwork_onoff(String network_onoff) {
		this.network_onoff = network_onoff;
	}

	public String getShow_desc() {
		return show_desc;
	}

	public void setShow_desc(String show_desc) {
		this.show_desc = show_desc;
	}

	public String getDvr() {
		return dvr;
	}

	public void setDvr(String dvr) {
		this.dvr = dvr;
	}
	
	public int getPs_fs_tax_rule() {
		return ps_fs_tax_rule;
	}

	public void setPs_fs_tax_rule(int ps_fs_tax_rule) {
		this.ps_fs_tax_rule = ps_fs_tax_rule;
	}
	
	public int getPs_prctag_printer() {
		return ps_prctag_printer;
	}

	public void setPs_prctag_printer(int ps_prctag_printer) {
		this.ps_prctag_printer = ps_prctag_printer;
	}

	public int getPs_rounding() {
		return ps_rounding;
	}

	public void setPs_rounding(int ps_rounding) {
		this.ps_rounding = ps_rounding;
	}

	public String getPs_print_service() {
		return ps_print_service;
	}

	public void setPs_print_service(String ps_print_service) {
		this.ps_print_service = ps_print_service;
	}
	
	public String getPs_sig_host() {
		return ps_sig_host;
	}

	public void setPs_sig_host(String ps_sig_host) {
		this.ps_sig_host = ps_sig_host;
	}

	public String getPs_sig_local() {
		return ps_sig_local;
	}

	public void setPs_sig_local(String ps_sig_local) {
		this.ps_sig_local = ps_sig_local;
	}

	public double getPs_sig_min() {
		return ps_sig_min;
	}

	public void setPs_sig_min(double ps_sig_min) {
		this.ps_sig_min = ps_sig_min;
	}

	public int getPs_receipt_pnt() {
		return ps_receipt_pnt;
	}

	public void setPs_receipt_pnt(int ps_receipt_pnt) {
		this.ps_receipt_pnt = ps_receipt_pnt;
	}

	public String toMGData(String Action) {
		String Result = Action + "|" + DatabaseSchema.PosSetting.SCHEMA_NAME
				+ "|(" + getPs_id() + "," + CheckNull(getPs_open_time())
				+ "," + CheckNull(getPs_close_time()) + "," + getPs_tare_rate() + "," + getPs_fc_max() 
				+ "," + CheckNull(getCreate_datetime()) + "," + CheckNull(getUpdate_datetime()) + "," + CheckNull(getPs_weight_unit())
				+ "," + getStore_no() + "," + getPrice_digits() + "," + CheckNull(getCurrency_sign()) 
				+ "," + CheckNull(getCalculate_weight()) + "," + CheckNull(getCalendar_type())
				+ "," + CheckNull(getNorm_upce()) + "," + CheckNull(getShow_desc()) 
				+ "," + CheckNull(getZero_baln()) + "," + CheckNull(getZero_price()) 
				+ "," + getPs_fs_tax_rule() + "," + getPs_prctag_printer() 
				+ "," + getPs_rounding() + "," + CheckNull(getPs_print_service())
				+ "," + CheckNull(getPs_sig_host()) + "," + CheckNull(getPs_sig_local())
				+ "," + getPs_sig_min() + "," + getPs_receipt_pnt() +")";
		return Result;
	}
	
	public String CheckNull(String value){
		if(value == null){
			return null;
		}else{
			return "'" + value + "'";
		}
	}
}
